const path = require('path');
const webpack = require('webpack');




const HtmlWebpackPlugin = require('html-webpack-plugin')




/*
 * We've enabled HtmlWebpackPlugin for you! This generates a html
 * page for you when you compile webpack, which will make you start
 * developing and prototyping faster.
 *
 * https://github.com/jantimon/html-webpack-plugin
 *
 */

module.exports = {
  mode: 'development',
  devtool: 'cheap-module-source-map',
  plugins: [new webpack.ProgressPlugin(), new HtmlWebpackPlugin({
            template: 'index.html'
          })],

  module: {
    rules: [{
      test: /\.(js|jsx)$/,
      include: [path.resolve(__dirname, 'src')],
      loader: 'babel-loader',
      options:{
        babelrc: false,
        presets:[
          require.resolve('@babel/preset-react'),
          [require.resolve('@babel/preset-env'), {modules: false}]
        ]
      }
    }]
  },

  devServer: {
    open: true,
    host: 'localhost'
  }
}